<?php
/**
 * ユニットテストクラス
 */
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/reporter.php';
require_once __DIR__ . '/../ScoreSelectController.php';

class Components_ScoreSelect_UnitTest extends UnitTestCase
{
	/**
	 * スコア入力メニュー作成テスト
	 */
	public function Test1100()
	{
		$_REQUEST[HttpRequest::FIRST_HALF_LOST] = 11;
		$objController = new Components_ScoreSelect_Controller('test', 'test');
		$RET
		= $objController->fetch(
				Components_ScoreSelect_Controller::KIND_FIRST_HALF_POINT);
		echo $RET;
		$RET
		= $objController->fetch(
				Components_ScoreSelect_Controller::KIND_FIRST_HALF_LOST);
		echo $RET;
	}

	/**
	 * スコア保存テスト
	 */
	public function Test1200()
	{
		$_REQUEST[HttpRequest::GAME_ID] = 'testsave';
		$_REQUEST[HttpRequest::FIRST_HALF_POINT] = 5;
		$_REQUEST[HttpRequest::FIRST_HALF_LOST] = 6;
		$_REQUEST[HttpRequest::SECOND_HALF_POINT] = 7;
		$_REQUEST[HttpRequest::SECOND_HALF_LOST] = 8;

		$obj = new Components_ScoreSelect_Mapper($_REQUEST[HttpRequest::GAME_ID]);
		$RET = $obj->save();
		$this->assertTrue($RET);
	}
}